import numpy as np
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
from matplotlib.patches import Circle

# 设置中文字体支持
plt.rcParams["font.family"] = ["SimHei", "WenQuanYi Micro Hei", "Heiti TC"]
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示问题
# 示例数据
data = np.array([
    [8, 200, 500],  # 项目A：战略地位8，难度200工时，盈利500万
    [6, 300, 300],  # 项目B
    [9, 150, 600]   # 项目C
])
scaler = MinMaxScaler()
scaled_data = scaler.fit_transform(data)

def chat():
    categories = ['战略地位', '难度', '盈利']
    num_vars = len(categories)
    angles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()
    angles += angles[:1]  # 闭合图形

    fig = plt.figure(figsize=(6, 6))
    ax = fig.add_subplot(111, polar=True)

    for i, project in enumerate(scaled_data):
        project_closed = np.concatenate((project, [project[0]]))
        ax.plot(angles, project_closed, label=f'项目{i+1}')
        ax.fill(angles, project_closed, alpha=0.25)

    ax.set_xticks(angles[:-1])
    ax.set_xticklabels(categories)
    ax.set_title('项目综合评估雷达图', y=1.1)
    plt.legend()
    plt.show()

if __name__ == '__main__':
    chat()